package com.weiyuwqj.admin.controller.admin.user;

//import com.weiyuwqj.api.hengfeng.model.base.HfBaseResponseBean;
//import com.weiyuwqj.api.hengfeng.model.base.HfResultBean;
//import com.weiyuwqj.api.hengfeng.model.recharge.HfQuickRechargeRequestByShop;
//import com.weiyuwqj.api.hengfeng.param.vo.HfCreateAuthVo;
import com.weiyuwqj.api.service.*;
import com.weiyuwqj.admin.controller.base.BaseController;
import com.weiyuwqj.api.common.Paginator;
import com.weiyuwqj.api.constant.Constants;
import com.weiyuwqj.api.constant.Message;
import com.weiyuwqj.api.exception.CrowdException;
import com.weiyuwqj.api.model.*;
import com.weiyuwqj.api.model.convert.*;
import com.weiyuwqj.api.model.vo.BasCouponVo;
import com.weiyuwqj.api.model.vo.BasTicketVo;
import com.weiyuwqj.api.model.vo.GuaranteeSecurityAndBankVo;
import com.weiyuwqj.api.model.vo.UserVo;
import com.weiyuwqj.api.service.module.creater.AbstractLogCreater;
import com.weiyuwqj.api.service.module.creater.RealnameLogCreater;
import com.weiyuwqj.api.util.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.util.*;

/**
 * Created by zhangyong on 2016/7/11.
 */
@RequestMapping("/admin/user")
@Controller
public class UserController extends BaseController {

    @Autowired
    BasUserService userService;

    @Autowired
    BusInvestRecordService recordService;

    @Autowired
    BusAccountRechargeService rechargeService;

    @Autowired
    BusAccountCashService accountCashService;

    @Autowired
    BasUserInviteService userInviteService;

    @Autowired
    BasCouponService couponService;

    @Autowired
    BasTicketService ticketService;

    @Autowired
    BasUserInfoService userInfoService;

    @Autowired
    BasUserSecurityService userSecurityService;

    @Autowired
    SysNoticeTypeService noticeTypeService;

    @Autowired
    SysTempcodeService tempcodeService;

    @Autowired
    BasItemService itemService;

    @Autowired
    BusAccountBankService bankService;
    @Autowired
    PayAccountService payAccountService;


    @ResponseBody
    @RequestMapping("/list")
    public Object index(Paginator p, String name, String mobile, Integer realnameStatus, String beginDate, String endDate,
                        String orderName, String orderWay, String type) {
        Map map = new HashMap();
        map.put("name", name);
        map.put("mobile", mobile);
        map.put("type", type);
        map.put("realnameStatus", realnameStatus);
        map.put("beginDate", beginDate);
        map.put("endDate", endDate);
        map.put("orderName", orderName);
        map.put("orderWay", orderWay);
        return userService.getList(p, map);
    }


    /**
     * 用户列表导出
     * @param request
     * @return
     */
    @ResponseBody
    @RequestMapping("/excelList")
    public Object excelList(HttpServletRequest request, String username, String mobile, String realname, Integer realnameStatus, String beginDate, String endDate, Integer type) {

        String[] cArray = {"ID", "用户名", "真实姓名", "性别", "手机号码", "身份证号码", "年龄", "实名状态", "锁定状态", "注册来源", "注册时间"};
        String[] eArray = {"Id", "Username", "Realname", "IdentifyCard", "Mobile", "IdentifyCard", "IdentifyCard", "RealnameStatus", "Status", "Referer", "Addtime"};
        ModelConvert[] converts = {null, null, null, new UserSexConvert(), null, null, new UserAgeConvert(), new UserRealnameStatusConvert(), new UserStatusConvert(), null, new UserAddtimeConvert()};

        List<String> cList = Arrays.asList(cArray);
        List<String> eList = Arrays.asList(eArray);
        List<ModelConvert> convertList = Arrays.asList(converts);
        Map map = new HashMap();
        map.put("username", username);
        map.put("realname", realname);
        map.put("type", type);
        map.put("mobile", mobile);
        map.put("realnameStatus", realnameStatus);
        map.put("beginDate", beginDate);
        map.put("endDate", endDate);

        List<UserVo> contentList = userService.getList(map);
        String serverDir = request.getServletContext().getRealPath("/") + "admin/export/";
        String excelFilePath = ExcelUtils.export("平台用户列表", cList, eList, convertList, contentList, serverDir);
        HashMap ret = Message.OK;
        ret.put("file", "export/" + excelFilePath);
        return ret;
    }

//    //根据userid获取基本信息
//    @ResponseBody
//    @RequestMapping("/getUserById")
//    public Object getUserById(Integer userId) {
//        return userService.getUserInfoById(userId);
//    }

    //根据userId统计资金信息
    @ResponseBody
    @RequestMapping(value = "/countMoneyByUserId", method = RequestMethod.POST)
    public Object countMoneyByUserId(Integer userId) {
        Map map = recordService.countInvestByUserId(userId);
        BigDecimal rechargeAmount = rechargeService.sumRechargeAmountByUserId(userId);
        BigDecimal cashAmount = accountCashService.sumCashAmountByUserId(userId);
        map.put("rechargeAmount", rechargeAmount);
        map.put("cashAmount", cashAmount);
        return map;
    }

    //根据userid获取被邀请人列表
    @ResponseBody
    @RequestMapping("/getBeInviteByUserId")
    public Object getBeInviteByUserId(Paginator p, Integer userId) {
        return userInviteService.getListByUserId(p, userId);
    }

    //根据userid获取邀请人
    @ResponseBody
    @RequestMapping("/getInviteByUserId")
    public Object getInviteByUserId(Integer userId) {
        return userInviteService.getOneByInviteId(userId);
    }


    //根据userid获取红包列表
    @ResponseBody
    @RequestMapping("/getCouponListByUserId")
    public Object getCouponListByUserId(Paginator p, Integer userId) {
        Map map = new HashMap();
        map.put("userId", userId);
        return couponService.getList(p, map);
    }

    //根据userid导出红包列表
    @ResponseBody
    @RequestMapping("/excelCouponList")
    public Object excelCouponList(HttpServletRequest request, Integer userId) {
        String[] cArray = {"名称", "金额", "来源", "状态", "要求使用的金额", "有效时间", "使用时间", "投资项目", "投资金额"};
        String[] eArray = {"CouponName", "Amount", "Way", "Status", "RequireAmount", "ExpiredTime", "UseTime", "ItemName", "InvestDealAmount"};
        ModelConvert[] converts = {null, null, null, new CouponStatusConvert(), null, new ItemAddtimeConvert(),
                new ItemAddtimeConvert(), null, null};

        List<String> cList = Arrays.asList(cArray);
        List<String> eList = Arrays.asList(eArray);
        List<ModelConvert> convertList = Arrays.asList(converts);
        Map param = new HashMap();
        param.put("userId", userId);

        List<BasCouponVo> contentList = couponService.getList(param);

        String serverDir = request.getServletContext().getRealPath("/") + "admin/export/";
        //String excelFilePath=ExcelUtils.export(allList,serverDir);
        String excelFilePath = ExcelUtils.export("用户管理红包", cList, eList, convertList, contentList, serverDir);

        HashMap ret = Message.OK;
        ret.put("file", "export/" + excelFilePath);
        return ret;
    }

    //获取单个红包信息
    @ResponseBody
    @RequestMapping("/getCouponByCouponId")
    public Object getCouponByCouponId(Integer couponId) {
        return couponService.getSingle(couponId);
    }

    //根据userid获取加息劵列表
    @ResponseBody
    @RequestMapping("/getTicketListByUserId")
    public Object getTicketListByUserId(Paginator p, Integer userId) {
        Map map = new HashMap();
        map.put("userId", userId);
        return ticketService.getList(p, map);
    }

    //根据userid导出加息劵列表
    @ResponseBody
    @RequestMapping("/excelTicketList")
    public Object excelTicketList(HttpServletRequest request, Integer userId) {
        String[] cArray = {"名称", "加息利率", "来源", "状态", "要求使用的金额", "有效时间", "使用时间", "投资项目", "投资金额"};
        String[] eArray = {"TicketName", "Rate", "Way", "Status", "RequireAmount", "ExpiredTime", "UseTime", "ItemName", "InvestDealAmount"};
        ModelConvert[] converts = {null, null, null, new CouponStatusConvert(), null, new ItemAddtimeConvert(),
                new ItemAddtimeConvert(), null, null};

        List<String> cList = Arrays.asList(cArray);
        List<String> eList = Arrays.asList(eArray);
        List<ModelConvert> convertList = Arrays.asList(converts);
        Map param = new HashMap();
        param.put("userId", userId);
        List<BasTicketVo> contentList = ticketService.getList(param);

        String serverDir = request.getServletContext().getRealPath("/") + "admin/export/";
        //String excelFilePath=ExcelUtils.export(allList,serverDir);
        String excelFilePath = ExcelUtils.export("用户管理加息劵", cList, eList, convertList, contentList, serverDir);

        HashMap ret = Message.OK;
        ret.put("file", "export/" + excelFilePath);
        return ret;
    }

    //获取单个加息券信息
    @ResponseBody
    @RequestMapping("/getTicketByCouponId")
    public Object getTicketByTicketId(Integer ticketId) {
        return ticketService.getSingle(ticketId);
    }

    //根据userId获取充值列表
    @ResponseBody
    @RequestMapping("/getRechargeListByUserId")
    public Object getRechargeListByUserId(Paginator p, Integer userId) {
        return rechargeService.getListByUserId(p, userId);
    }

    //根据userId获取提现列表
    @ResponseBody
    @RequestMapping("/getCashListByUserId")
    public Object getCashListByUserId(Paginator p, Integer userId) {
        return accountCashService.getListByUserId(p, userId);
    }


    //根据userId获取投资记录
    @ResponseBody
    @RequestMapping(value = "/getListByUserId", method = RequestMethod.POST)
    public Object getListByUserId(Paginator p, Integer userId) {
        Map map = new HashMap();
        map.put("userId", userId);
        return recordService.getList(p, map);
    }


    //根据userId获取借款列表
    @ResponseBody
    @RequestMapping(value = "/getItemByUserId", method = RequestMethod.POST)
    public Object getItemByUserId(Paginator p, Integer userId) {
        Map map = new HashMap();
        map.put("userId", userId);
        return itemService.getList(p, map);
    }

    //根据userId获取企业信息
    @ResponseBody
    @RequestMapping(value = "/getGuaranteeSecurityByUserId", method = RequestMethod.POST)
    public Object getGuaranteeSecurityByUserId(Integer userId) {
        GuaranteeSecurityAndBankVo security = userService.getGuaranteeByUserId(userId);
        BusAccountBank bank = bankService.getOneByUserId(userId);
        if (bank != null) {
            BeanUtils.copyProperties(bank, security);
        }
        return security;

    }


    //后台不分页列表
    @ResponseBody
    @RequestMapping(value = "/getNoPageList", method = RequestMethod.POST)
    public Object getNoPageList(Integer type) {
        Map map = new HashMap();
        map.put("type", type);
        map.put("realnameStatus", 1);
        return userService.getList(map);
    }


    @ResponseBody
    @RequestMapping("/statUser")
    public Object statUser(String username, String mobile, String realname, Integer realnameStatus, String beginDate, String endDate) {
        Map queryMap = new HashMap();
        queryMap.put("username", username);
        queryMap.put("mobile", mobile);
        queryMap.put("realname", realname);
        queryMap.put("realnameStatus", realnameStatus);
        queryMap.put("beginDate", beginDate);
        queryMap.put("endDate", endDate);

        Map map = new HashMap();
        Map ret = new HashMap();
        long[] val = {0, 0};
        List<Map> list = userService.statUser(queryMap);
        for (int i = 0; i < list.size(); i++) {
            map = list.get(i);
            long num = (long) map.get("userNum");
            int no = (int) map.get("realname_status");
            val[no] = num;
        }
        ret.put("unRealNum", val[0]);
        ret.put("realNum", val[1]);
        return ret;
    }


    //更新用户基本信息
    @ResponseBody
    @RequestMapping("/updateUserInfo")
    public Object updateUserInfo(BasUserInfo userInfo, Integer type, Integer userId) {
        if (type != null) {
            BasUser user = new BasUser();
            user.setId(userId);
            user.setType(type);
            userService.updateNotNull(user);
        }
        userInfoService.updateNotNull(userInfo);
        return Message.OK;
    }

    //更改邀请备注信息
    @ResponseBody
    @RequestMapping("/updateInviteRemark")
    public Object updateInviteRemark(Integer id, String remark) {
        BasUserInvite userInvite = new BasUserInvite();
        userInvite.setId(id);
        userInviteService.updateNotNull(userInvite);
        return Message.OK;
    }

    //添加用户
    @ResponseBody
    @RequestMapping("/add")
    public Object add(BasUser user, BasUserInfo info) {
        BasUser basUser = userService.getUserByMobile(user.getMobile());
        if (null != basUser) {
            throw new CrowdException("user.register.mobile_already_exists");
        }
        String salt = RandomCodesUtils.createRandom(false, 4);
        user.setSalt(salt);
        try {
            user.setPassword(MD5.toMD5(user.getPassword() + salt));
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        user.setAddtime(new Date());
        user.setAddip(IpUtils.get());
        user.setStatus(1);
        user.setReferer("sys");

        userService.doRegister(user, "", info);
        return Message.OK;
    }

//    //实名 type 1-投资人，2-借款人，3-担保人，4-咨询,5-平台，6-投资借款
//    @ResponseBody
//    @RequestMapping("/doRealname")
//    public Object doRealname(Integer userId, String realname, String IdCard, Integer type) {
//        return userSecurityService.doRealname(userId, realname, IdCard, type);
//    }

    //修改绑定旧手机短信
    @ResponseBody
    @RequestMapping(value = "/oldModifyMobileSms")
    public Object oldModifyMobileSms(HttpServletRequest request) {
        String randomCode = RandomCodesUtils.createRandom(true, 6);
        String mobile = request.getParameter("mobile");
        SysNoticeType noticeType = noticeTypeService.getNoticeTypeByNid("modifymobile_sms");
        return smsInfo(request, randomCode, "13858101403", noticeType);
    }

    //修改绑定新手机
    @ResponseBody
    @RequestMapping(value = "/newModifyMobileSms")
    public Object newModifyMobileSms(HttpServletRequest request) {
        String randomCode = RandomCodesUtils.createRandom(true, 6);
        String mobile = request.getParameter("mobile");
        SysNoticeType noticeType = noticeTypeService.getNoticeTypeByNid("modifymobile_sms");
        SysTempcode tempcode = new SysTempcode();
        tempcode.setAddtime(new Date());
        tempcode.setAddip(IpUtils.get());
        tempcode.setCode(randomCode);
        tempcode.setMobile(mobile);
        tempcodeService.save(tempcode);
        return smsInfo(request, randomCode, mobile, noticeType);
    }

    public Object smsInfo(HttpServletRequest request, String vaildPhoneCode, String mobile, SysNoticeType noticeType) {
        String content = noticeType.getTypeContent();
        String randomCode = vaildPhoneCode;
        System.out.println("您的验证码：" + randomCode);
        content = content.replace(Constants.VALIDATECODE, randomCode);

        //SmsService sms = new YiMeiSmsImpl();

        Map smsMap = new HashMap();
        smsMap.put("msgText", content);
        smsMap.put("mobile", mobile);
        String smsResponse = Sms.send(mobile, content).toString();

        Map ret = new HashMap();
        if (smsResponse.equals("发送成功")) {
            ret.put("result", "success");
            ret.put("validPhoneExpiredTime", new Date());
            request.getSession().setAttribute("randomCode", randomCode);
            request.getSession().setAttribute("randomCodeAddtime", System.currentTimeMillis());
        } else {
            ret.put("result", "fail");
            ret.put("message", smsResponse);
        }
        return ret;
    }

//    /**
//     * 修改绑定手机
//     */
//    @ResponseBody
//    @RequestMapping("/modifyMobile")
//    public Object modifyMobile(HttpServletRequest request, String oldMobile, String mobile, String inputRandomCode) {
//        String jsCode = request.getSession().getAttribute("randomCode").toString();
//        Long validPhoneExpiredTime = (long) request.getSession().getAttribute("randomCodeAddtime");
//        BasUser oldUser = userService.getUserByMobile(oldMobile);
//        BasUser user = userService.getUserByMobile(mobile);
//        //判断新手机是否存在
//        if (null != user) {
//            throw new CrowdException("user.register.mobile_already_exists");
//        }
//        //判断验证码与手机是否匹配
//        SysTempcode tempcode = tempcodeService.getByMobileAndCode(mobile, jsCode);
//        if (tempcode == null) {
//            throw new CrowdException("user.register.randomCode.error");
//        }
//        //短信校验
//        Date now = new Date();
//        long between = (now.getTime() - validPhoneExpiredTime) / 1000;
//
//        if (!(jsCode.equals(inputRandomCode))) {
//            throw new CrowdException("user.register.randomCode.error");
//        }
//        if (between > Constants.VALIDATETIME) {
//            throw new CrowdException("user.register.randomCode.timeout");
//        }
//        //修改手机号码
//        userService.modifyMobile(mobile, oldUser.getId());
//        request.getSession().removeAttribute("randomCode");
//        request.getSession().removeAttribute("randomCodeAddtime");
//        return Message.OK;
//    }

    /**
     * 校验验证码
     */
    @ResponseBody
    @RequestMapping("/checkMobile")
    public Object checkMobile(HttpServletRequest request, String inputRandomCode) {
        String jsCode = request.getSession().getAttribute("randomCode").toString();
        Long validPhoneExpiredTime = (long) request.getSession().getAttribute("randomCodeAddtime");
        Date now = new Date();
        long between = (now.getTime() - validPhoneExpiredTime) / 1000;

        if (!(jsCode.equals(inputRandomCode))) {
            throw new CrowdException("user.register.randomCode.error");
        }
        if (between > Constants.VALIDATETIME) {
            throw new CrowdException("user.register.randomCode.timeout");
        }
        request.getSession().removeAttribute("randomCode");
        request.getSession().removeAttribute("randomCodeAddtime");
        return Message.OK;
    }

    //用户绑定邀请人
    @ResponseBody
    @RequestMapping(value = "/inviteBinding", method = RequestMethod.POST)
    public Object inviteBinding(Integer userId, String inviteCode) {
        Map map = userInviteService.inviteBinding(userId, inviteCode);
        return map;
    }

    //修改提现限制状态
    @ResponseBody
    @RequestMapping(value = "/modifyCashLimit", method = RequestMethod.POST)
    public Object modifyCashLimit(Integer userId, Integer status) {
        BasUserInfo info = userInfoService.getOneByUserId(userId);
        userInfoService.modifyCashLimit(status, info.getCashLimit(), userId);
        return Message.OK;
    }

    //根据userId修改出生地址和居住地
    @ResponseBody
    @RequestMapping(value = "/modifyAddressByUserId", method = RequestMethod.POST)
    public Object modifyAddressByUserId(BasUserInfo info) {
        userInfoService.modifyAddressByUserId(info);
        return Message.OK;
    }


//    /**
//     * 实名认证
//     *
//     * @param realname  用户真实姓名
//     * @param userId    用户ID
//     * @param idCode    身份证号
//     * @param cardNo    银行卡号
//     * @param preMobile 银行预留手机号
//     * @param bankName  银行名称
//     * @return
//     */
//    @ResponseBody
//    @RequestMapping(value = "/realName", method = RequestMethod.POST)
//    public Object realName(String realname, String idCode, Integer userId, String cardNo, String preMobile, String bankName) {
//        BasUser user = userService.selectByKey(userId);
//        if (user == null) {
//            throw new CrowdException("user.register.mobile_no_already_exists");
//        }
//        BasUserSecurity security = userSecurityService.getOneByIdCard(idCode);
//        if (security != null) {
//            throw new CrowdException("user.bank.idCard.already_exists");
//        }
//        security = userSecurityService.getOneByUserId(userId);
//        if (security.getRealnameStatus() == 1) {
//            throw new CrowdException("user.security.already_exists");
//        }
//        HfCreateAuthVo createAuthVo = new HfCreateAuthVo();
//        createAuthVo.setRealName(realname); // 真实姓名
//        createAuthVo.setUserId(userId.toString()); // 用户ID
//        createAuthVo.setIdCode(idCode); // 身份证号码
//        createAuthVo.setBizType("06"); // 无用字段
//        createAuthVo.setMobile(user.getMobile()); // 用户手机号码
//        createAuthVo.setCertNo(cardNo); // 银行卡号码
//        createAuthVo.setPreMobile(preMobile); // 银行预留手机号码
//        HfResultBean resultBean = payAccountService.createAuth(createAuthVo); // 发送开户信息
//        //失败信息
//        //{"error_data":[{"error_no":"45000","platcust":"2017033121100683010207","detail_no":"1491011132760","card_no":"13555555555","error_info":"注册失败：此身份证号\"124353453453453454\"已在平台注册！","mobile":"13555555555"}],
//        // "finish_datetime":"2017-04-01 09:45:34","order_info":"批量注册处理完成","order_status":"2","recode":"10000","remsg":"成功","signdata":"38a8cf8f3acfff4870ecfaf9686e8368","success_num":0,"total_num":1}
//        //成功信息
//        //{"finish_datetime":"2017-04-01 10:14:47","order_info":"批量注册处理完成","order_status":"2","recode":"10000","remsg":"成功","signdata":"f6c9476c1a5c8e3040678bd25c3cf90d",
//        // "success_data":[{"platcust":"2017040110144708010210","detail_no":"14910128575994","mobile":"13799999999"}],"success_num":1,"total_num":1}
//        AbstractLogCreater logCreater = new RealnameLogCreater();
//        logCreater.crate(user.getId(), IpUtils.get());
//        logCreater.setProperty();
//
//        logCreater.getLog().setResult(1);
//        BusAccountBank bank = new BusAccountBank();
//        bank.setAddtime(new Date());
//        bank.setUserId(userId);
//        bank.setCardNo(cardNo);
//        bank.setMobile(preMobile);
//        bank.setStatus(1);
//        bank.setType(1);
//        bank.setBankName(bankName);
//        bankService.save(bank);
//        userSecurityService.modifyRealnameByUserIdAndLog(realname, idCode, userId, logCreater, resultBean.getSuccessData()); // 保存信息
//        return Message.OK;
//    }

//    /**
//     * 公司绑卡
//     *
//     * @param userId     用户id
//     * @param preMobile  预留手机号码
//     * @param orgNo      组织机构代码
//     * @param acctName   账户名称
//     * @param acctNo     账号
//     * @param openBranch 开户银行（精确到分行）
//     * @return
//     */
//    @ResponseBody
//    @RequestMapping(value = "/companyBank", method = RequestMethod.POST)
//    public Object companyBank(Integer userId, String preMobile, String orgNo, String acctName, String acctNo, String openBranch) {
//        Integer type = 2;
//        userService.companyBank(userId, preMobile, orgNo, acctName, acctNo, openBranch, type);
//        return Message.OK;
//    }

//
//    @ResponseBody
//    @RequestMapping(value = "/doUserRecharge", method = RequestMethod.POST)
//    public Object doUserRecharge(Integer userId, BigDecimal amount) {
//        //订单号
//        String orderNo = StringUtils.getOrderNo();
//        //查询用户信息
//        BasUser basUser = userService.selectByKey(userId);
//        HfQuickRechargeRequestByShop quickRechargeRequestByShop = new HfQuickRechargeRequestByShop();
//        quickRechargeRequestByShop.setOrder_no(orderNo);                        // 订单ID
//        quickRechargeRequestByShop.setPlatcust(basUser.getPlatformId());        // 用户编号
//        quickRechargeRequestByShop.setAmt(amount.toString());                   // 充值金额
//        quickRechargeRequestByShop.setCharge_type("1");                         // 充值类型，1-投资用户，2-融资账户
//        quickRechargeRequestByShop.setType("1");                                // 类型，1-用户充值
////        quickRechargeRequestByShop.setBankcode();                               // 银行编码
////        quickRechargeRequestByShop.setNotify_url();                             // 异步回调地址
////        quickRechargeRequestByShop.setReturn_url();                             // 同步回调地址
//        quickRechargeRequestByShop.setPay_code("029");                          // 支付通道
//        //请求恒丰
//        Map map = SignUtils.getURLParamByMap(SignUtils.getTreeMap(ParamUtils.getBeanMap(quickRechargeRequestByShop)));
//        return map;
//    }

	/**
	 * 获取投资企业用户
	 *
	 * @param balance 标余额
	 * @return 投资企业用户列表
	 */
	@ResponseBody
	@RequestMapping(value = "/getEnterpriesUser", method = RequestMethod.POST)
	public Object getEnterpriesUser(String balance) {
		List<BasUser> enterprises = userService.getEnterpriesUser(balance); // 投资企业基本信息
		return enterprises;
	}

}
